//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using OpenLS.Core.Serialization;
using OpenLS.Vml.Serialization;

namespace OpenLS.Vml.Drawing
{
    public class Callout : ShapeElement
    {
        private Ext? _ext;
        private bool? _on;
        private Angle? _angle;
        private string _gap;
        private string _drop;
        private string _distance;
        private bool? _lengthspecified;
        private bool? _accentbar;
        private bool? _textborder;
        private bool? _minusy;
        private bool? _minusx;
        private string _type;
        private string _length;
        private bool? _dropauto;

        public Ext? Ext
        {
            get { return _ext; }
            set { _ext = value; }
        }

        public bool? On
        {
            get { return _on; }
            set { _on = value; }
        }

        public Angle? Angle
        {
            get { return _angle; }
            set { _angle = value; }
        }

        public string Gap
        {
            get { return _gap; }
            set { _gap = value; }
        }

        public string Drop
        {
            get { return _drop; }
            set { _drop = value; }
        }

        public string Distance
        {
            get { return _distance; }
            set { _distance = value; }
        }

        public bool? Minusx
        {
            get { return _minusx; }
            set { _minusx = value; }
        }

        public bool? Minusy
        {
            get { return _minusy; }
            set { _minusy = value; }
        }

        public bool? Textborder
        {
            get { return _textborder; }
            set { _textborder = value; }
        }

        public bool? Accentbar
        {
            get { return _accentbar; }
            set { _accentbar = value; }
        }

        public bool? Lengthspecified
        {
            get { return _lengthspecified; }
            set { _lengthspecified = value; }
        }

        public string Type
        {
            get { return _type; }
            set { _type = value; }
        }

        public string Length
        {
            get { return _length; }
            set { _length = value; }
        }

        public bool? Dropauto
        {
            get { return _dropauto; }
            set { _dropauto = value; }
        }

        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read(VmlConstants.WordNamespace + "callout"))
            {
                Ext = c.GetOptionalEnum<Ext>(VmlConstants.VmlNamespace + "ext");
                On = c.GetOptionalBoolean("on");
                Type = c.GetOptionalString("type");
                Gap = c.GetOptionalString("gap");
                Angle = c.GetOptionalEnum<Angle>("angle");
                Dropauto = c.GetOptionalBoolean("dropauto");
                Drop = c.GetOptionalString("drop");
                Distance = c.GetOptionalString("distance");
                Lengthspecified = c.GetOptionalBoolean("lengthspecified");
                Length = c.GetOptionalString("length");
                Accentbar = c.GetOptionalBoolean("accentbar");
                Textborder = c.GetOptionalBoolean("textborder");
                Minusx = c.GetOptionalBoolean("minusx");
                Minusy = c.GetOptionalBoolean("minusy");
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (var c = context.Write(VmlConstants.WordNamespace  + "callout"))
            {
                c.SetOptionalEnum<Ext>(VmlConstants.VmlNamespace + "ext", Ext);
                c.SetOptionalBoolean("on", On);
                c.SetOptionalString("type", Type );
                c.SetOptionalString("gap", Gap );
                c.SetOptionalEnum<Angle>("angle", Angle );
                c.SetOptionalBoolean("dropauto", Dropauto );
                c.SetOptionalString("drop", Drop );
                c.SetOptionalString("distance", Distance );
                c.SetOptionalBoolean("lengthspecified", Lengthspecified );
                c.SetOptionalString("length", Length );
                c.SetOptionalBoolean("accentbar", Accentbar );
                c.SetOptionalBoolean("textborder", Textborder );
                c.SetOptionalBoolean("minusx", Minusx );
                c.SetOptionalBoolean("minusy", Minusy );
            }
        }
    }
}
